/* File Created: April 8, 2013 */
var bookService = function () {
	var getData = function (callback) {
			return dataSrv.getXML(urlGet, {
				action: "showOverview"
			});
		},

		getOverview = function (callback) {
            return dataSrv.getJson('api/v1/mobile/show-overview',
                                       {
//                                       access_token: strAccessToken,
                                       page: callback.page,
                                       max_numbers: callback.maxPage,
                                       category_id: callback.categoryId
                                       });

		},

		getNewestStartPage = function (callback) {
            return dataSrv.getJson('api/v1/mobile/mobile-startpage-detail',
                                       {
//                                       access_token: strAccessToken,
                                       page: callback.page,
                                       list_id: callback.listId,
                                       max_numbers: callback.maxPage
                                       });

		},

		getStartPage = function (callback) {
            return dataSrv.getJson('api/v1/mobile/mobile-startpage',
                                       {
//                                       access_token: strAccessToken
                                       });

		},

		getStartPageSetting = function (callback) {
            return dataSrv.getJson('api/v1/mobile/mobile-startpage-settings',
                                       {
//                                       access_token: strAccessToken
                                       });

		},

		postStartPageSetting = function (callback) {
            return dataSrv.postJson('api/v1/mobile/mobile-startpage-settings',
                                       callback.data);
            
		},

		getBy = function (callback) {
            return dataSrv.getJson('api/v1/mobile/search',
                                       {
//                                       access_token: strAccessToken,
                                       query: callback.keySearch
                                       });

		},

		activeBook = function (callback) {
            
            return dataSrv.getJson('api/v1/mobile/activate-summary',
                                       {
//                                       access_token: strAccessToken,
                                       data_id: callback.dataId
                                       });

		},
        addFavorite = function (callback) {
            return dataSrv.getJson('api/v1/mobile/add-favorite',
                {
//                    access_token: strAccessToken,
                    folder_id: callback.folder_id,
                    data_id: callback.data_id
                });

        },
        removeFavorite = function (callback) {
            return dataSrv.getJson('api/v1/mobile/remove-favorite',
                                       {
//                                       access_token: strAccessToken,
                                       folder_id: callback.folder_id,
                                       data_id: callback.data_id
                                       });

		},

		buyTheBook = function (callback) {
            return dataSrv.getJson('api/v1/mobile/buy-book',
                {
//                    access_token: strAccessToken,
                    data_id: callback.dataId,
                    version: appVersionPrefix+appVersion
                });

		},

		getComments = function (callback) {
            return dataSrv.getJson('api/v1/mobile/comments',
                                   {
//                                   access_token: strAccessToken,
                                   data_id: callback.dataId
                                   });
            
			
		},

		getAnnotations = function (callback) {
            return dataSrv.getJson('api/v1/mobile/annotations',
                                       {
//                                       access_token: strAccessToken,
                                       data_id: callback.dataId
                                       });

		},

		postComments = function (callback) {
            return dataSrv.getJson('api/v1/mobile/add-comment',
                                   {
//                                   access_token: strAccessToken,
                                   data_id: callback.dataId,
                                   comment: callback.comment
                                   });
			
		},

		postShareEmail = function (callback) {
            return dataSrv.getJson('api/v1/mobile/email-send-to-friend',
                                       {
//                                       access_token: strAccessToken,
                                       data_id: callback.dataId,
                                       email: callback.email,
                                       text: callback.text
                                       });

		},

		getDetail = function (callback) {
            
            var noLoggingStatus = false;
            if (callback.noLogging != undefined && callback.noLogging == true){
                noLoggingStatus = true;
            }
            
            
            return dataSrv.getJson('api/v1/mobile/download-summary',
                                       {
//                                       access_token: strAccessToken,
                                       data_id: callback.id,
                                       noLogging: noLoggingStatus
                                       
                                       });

			
		};

	return {
		getData: getData,
		getOverview: getOverview,
		getDetail: getDetail,
		getStartPage: getStartPage,
		getStartPageSetting: getStartPageSetting,
		postStartPageSetting: postStartPageSetting,
		activeBook: activeBook,
		buyTheBook: buyTheBook,
        addFavorite: addFavorite,
        removeFavorite: removeFavorite,
		getComments: getComments,
		getAnnotations: getAnnotations,
		postComments: postComments,
		postShareEmail: postShareEmail,
		getBy: getBy,
		getNewestStartPage: getNewestStartPage
	};
}();
